/*****************************************************************
**                                                             	**
**  Copyright (C) 2007 Amlogic,Inc.                            	**
**  All rights reserved                                        	**
**        Filename : NetmenuSetup.c /Project:AVOS		       **
**        Revision : 1.0                                       	**
**                                                             	**
*****************************************************************/
#include "../menu.h"
#include "NetmenuSetupEvent.h"
#include "NetmenuSetup_720P.h"

extern INT8U CurrentOsdSize;

//char VERSION_MENU_STR[]         = __DATE__;
extern char VERSION_MENU_STR[];


INT32S WinSetup_net_menuMsgProc_720P(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return WinSetupOnShow(hwnd, lpParam) ;
    }
    return 0 ;
}

void SetWinSetup_net_menuPalette_720P(void)
{
    YUVENTRY mask_para[4] = {0,79,4095,4095};
    AWSetAlphaMask(0,4, mask_para);
    YUVENTRY palette_para[16] = {0x8000 | 16392,0x8000 | 21176,0x8000 | 17752,0x8000 | 16392,17592,19496,19832,19656,19992,18104,17673,17817,15864,15721,14460,16344};
    AWSetPalette(0,16, palette_para);
    return ;
}

void SetWinSetup_net_menuPos_720P(HWND* pControl, INT8U CurOsdSize)
{
    switch(CurOsdSize){
		case OsdSize720p:
			RECT WindowRect720p = {0,0,1280,720};
            pControl->winrect = WindowRect720p;
            CREATEWINDOWPARAM WindowPara720p = {1,{{0,0,1280,720},    {0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},    SetWinSetup_net_menuPalette_720P};
            AWSendMessage(pControl, WM_WINDOW_RESET_DRAW_AREA, (INT32S)&WindowPara720p);
			break;
	   
    }//end of switch
    return;
}

HWND *CreateControlWinSetup_net_menu_720P(HWND* pParent,INT8U CurOsdSize)
{
    HWND* pNewControl;
    switch(CurOsdSize){
		
		case OsdSize720p:
		     CREATEWINDOWPARAM window_para720p = {1,{{0,0,1280,720},{0,0,0,0},{0,0,0,0},{0,0,0,0}},{PF_PALETTE_256,0,0,0},SetWinSetup_net_menuPalette_720P};
            //Create Menu Window -- 1
            pNewControl = AWCreateWinControl("TWindow","WinSetup_net_menu_720P",WS_OVERLAPPEDWINDOW,
		                      0,0,1280,720,NULL, (INT32S)&window_para720p,WinSetup_net_menuMsgProc_720P) ;
            pNewControl->win_id = 0 ;
            break ;
	   
	}//end of switch
            return pNewControl;
}


void SetWinSetupMenuPos_720P(HWND* pControl, INT8U CurOsdSize)
{
    int iLoop;
    switch(CurOsdSize){
		
		case OsdSize720p:
            pControl->winrect.top = pControl->parent->winrect.top + 0;
            pControl->winrect.left = pControl->parent->winrect.left + 0;
            pControl->winrect.width = 1280;
            pControl->winrect.height = 720;
            pControl->draw_info_num = 25;
            RECT DrawRect720p[25] = {
				{pControl->winrect.left + 0,pControl->winrect.top + 0,1280,720},// 0
				{pControl->winrect.left + 17,pControl->winrect.top + 20,212,116}, // 1
				{pControl->winrect.left + 1000,pControl->winrect.top + 110,100,28},// 2 VERSION_MENU_STR  540
				
				{pControl->winrect.left + 0,pControl->winrect.top + 528,720,48},// 3				
				{pControl->winrect.left + 0,pControl->winrect.top + 0,720,48},// 4
				
				{pControl->winrect.left + 200,pControl->winrect.top + 230,804,40},// 5
				{pControl->winrect.left + 200,pControl->winrect.top + 230,804,40},// 6
				
				{pControl->winrect.left + 1080,pControl->winrect.top + 222,36,336},// 7
				{pControl->winrect.left + 1080,pControl->winrect.top + 236,36,24},// 8				
				
				{pControl->winrect.left + 240,pControl->winrect.top + 240,230,28},	//9
				{pControl->winrect.left + 240,pControl->winrect.top + 281,230,28},// 10
				{pControl->winrect.left + 240,pControl->winrect.top + 323,230,28},// 11
				{pControl->winrect.left + 240,pControl->winrect.top + 364,230,28},// 12
				{pControl->winrect.left + 240,pControl->winrect.top + 405,230,28},// 13
				{pControl->winrect.left + 240,pControl->winrect.top + 446,230,28},// 14
				{pControl->winrect.left + 240,pControl->winrect.top + 487,230,28},// 15
				{pControl->winrect.left + 240,pControl->winrect.top + 528,230,28},// 16
				
				{pControl->winrect.left + 700,pControl->winrect.top + 240,200,28}, // 17
				{pControl->winrect.left + 700,pControl->winrect.top + 281,200,28},// 18
				{pControl->winrect.left + 700,pControl->winrect.top + 323,200,28},// 19
				{pControl->winrect.left + 700,pControl->winrect.top + 364,200,28},// 20
				{pControl->winrect.left + 700,pControl->winrect.top + 405,200,28},// 21
				{pControl->winrect.left + 700,pControl->winrect.top + 446,200,28},// 22
				{pControl->winrect.left + 700,pControl->winrect.top + 487,200,28},// 23
				
				{pControl->winrect.left + 700,pControl->winrect.top + 528,200,28},// 24
            };
            for(iLoop=0; iLoop < 25; iLoop++)
                memcpy(&(pControl->draw_info[iLoop]), &DrawRect720p[iLoop], sizeof(RECT));
            break ;
  
        
	
    }//end of switch
    return;
}

INT32S WinSetupMenuMsgProc_720P(PHWND hwnd, INT32U msg_type, INT32S lpParam)
{
    switch( msg_type){
        case WM_SHOWWINDOW:
            return WinSetupMenuOnShow(hwnd, lpParam) ;
        case WM_KEYDOWN:
            return WinSetupMenuShowOnKeyPress(hwnd, lpParam) ;
		case WM_PAINT:
			return WinSetupMenuOnPaint(hwnd, lpParam);
				
    }
    return 0 ;
}

HWND *CreateControlWinSetupMenu_720P(HWND *pParent,INT8U CurOsdSize)
{
    //Create Control -- WinPicSlideShow
    HWND *pNewControl;
    switch(CurOsdSize){
		
		case OsdSize720p:
            pNewControl = AWCreateWinControl("TControl","WinSetupMenu_720P",(WS_CHILDWINDOW | WS_CHILDWINDOW),
		                      0,0,1280,720,pParent,0,WinSetupMenuMsgProc_720P) ;
            pNewControl->win_id = 11 ;
            pNewControl->draw_info_num = 25;
            pNewControl->draw_info = (PDRAWINFO)AVMem_umalloc(sizeof(DRAWINFO) * pNewControl->draw_info_num) ;
            DRAWINFO DrawDatas720p[25] = {
				          
			{0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},//0 ICON_SETUP_BACKGROUND_720P
			{0,0,0,0,(INT32U)ICON_SETUP_TOP,DT_RLE_BMP_DATA},// 1                          
			{0,0,0,0,(INT32U)VERSION_MENU_STR,DT_STRING_DATA},// 2

			{0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},// 3 top
			{0,0,0,0,(INT32U)0,DT_RLE_BMP_DATA},// 4 bottom
			
			{0,0,0,0,(INT32U)ICON_SETUP_BAR,DT_RLE_BMP_DATA},// 5
			{0,0,0,0,(INT32U)ICON_SETUP_SELECT_BAR,DT_RLE_BMP_DATA},// 6
			
			{0,0,0,0,(INT32U)ICON_PROCESS_BAR,DT_RLE_BMP_DATA},// 7
			{0,0,0,0,(INT32U)ICON_SLIDE_BAR,DT_RLE_BMP_DATA},//8

			{0,0,0,0,(INT32U)MENU_LANGUAGE,DT_RESOURCE_STRING_DATA},//9
			{0,0,0,0,(INT32U)SLIDESHOW_DUR_STR,DT_RESOURCE_STRING_DATA},// 10
			{0,0,0,0,(INT32U)SLIDESHOW_MODE_STR,DT_RESOURCE_STRING_DATA},// 11
			{0,0,0,0,(INT32U)MUSIC_REPEAT_STR,DT_RESOURCE_STRING_DATA},// 12
			{0,0,0,0,(INT32U)MOVIE_REPEAT_STR,DT_RESOURCE_STRING_DATA},// 13
			{0,0,0,0,(INT32U)DISPLAY_MODE_STR,DT_RESOURCE_STRING_DATA},// 14
			{0,0,0,0,(INT32U)TV_SYSTEM_STR,DT_RESOURCE_STRING_DATA},// 15
			{0,0,0,0,(INT32U)AUTO_RUN_STR,DT_RESOURCE_STRING_DATA},// 16  

			{0,0,0,0,(INT32U)LANGUAGE_CHINESE_STR,DT_RESOURCE_STRING_DATA},// 17
			{0,0,0,0,(INT32U)SLIDE_TIME_5S_STR,DT_RESOURCE_STRING_DATA},// 18

			{0,0,0,0,(INT32U)SLIDESHOW_MODE_10_STR,DT_RESOURCE_STRING_DATA},// 19
			{0,0,0,0,(INT32U)REPEAT_ALL_STR,DT_RESOURCE_STRING_DATA},// 20
			{0,0,0,0,(INT32U)REPEAT_ALL_STR,DT_RESOURCE_STRING_DATA},// 21
			{0,0,0,0,(INT32U)DISPLAY_MODE_43_STR,DT_RESOURCE_STRING_DATA},// 22
#ifdef WISTAR_VERSION
			{0,0,0,0,(INT32U)TV_SYSTEM_480P_STR,DT_RESOURCE_STRING_DATA},//23
#else
			{0,0,0,0,(INT32U)TV_SYSTEM_480I_STR,DT_RESOURCE_STRING_DATA},//23
#endif
			{0,0,0,0,(INT32U)AUTO_RUN_OPEN_STR,DT_RESOURCE_STRING_DATA},//24
			
						  
		    };
            memcpy(pNewControl->draw_info,DrawDatas720p, sizeof(DRAWINFO) * pNewControl->draw_info_num) ;

			DisplayMenuOptionFromEEPROM(pNewControl);
				
			break ;
 
					
	}//end of switch
            return pNewControl;
}

HWND *CreateWinSetupMenu_720P(void)
{
    HWND *pNewControl ;
    TWINDOWS *pWin;
    HWND *pWinSetup_net_menu = CreateControlWinSetup_net_menu_720P(NULL,CurrentOsdSize);
    SetWinSetup_net_menuPos_720P(pWinSetup_net_menu,CurrentOsdSize);

   

    pNewControl= CreateControlWinSetupMenu_720P(pWinSetup_net_menu,CurrentOsdSize);
    SetWinSetupMenuPos_720P(pNewControl,CurrentOsdSize);


    pWin = (TWINDOWS *)pWinSetup_net_menu;
    pWin->pFocusControl = AWFindWinCtrlByName("WinSetupMenu_720P");//WinPicSlideShow,WinSetup_net_menu
    return pWinSetup_net_menu;
}

